Skip to content

feat(doc): migrate from solang to solar#14447

Merged
mablr merged 7 commits intomasterfrom
mablr/migrate-forge-doc-solang-to-solar
Apr 29, 2026
Merged

feat(doc): migrate from solang to solar#14447
mablr merged 7 commits intomasterfrom
mablr/migrate-forge-doc-solang-to-solar

Conversation

@mablr
Copy link
Copy Markdown
Collaborator

@mablr mablr commented Apr 24, 2026

Motivation

Replace all solang_parser usage in forge-doc with solar AST. Use owned purpose-built structs (ParamInfo, ContractSource, FunctionSource, etc.) extracted at walk time instead of cloning arena-allocated solar AST nodes.

  • Add parser/source.rs with owned doc structs
  • Rewrite Parser to walk solar AST items directly
  • Parse doc comments from solar's DocComments (raw text)
  • Update builder to use solar AST from gcx, remove solang re-parse
  • Update writer and preprocessor layers for owned structs
  • Delete solang_ext/ module (Visitor, Visitable, AstEq, etc.)
  • Remove solang-parser dependency from forge-doc
  • Decouple chisel from forge-doc (inline CodeLocation/SafeUnwrap)

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Replace all solang_parser usage in forge-doc with solar AST.
Use owned purpose-built structs (ParamInfo, ContractSource,
FunctionSource, etc.) extracted at walk time instead of cloning
arena-allocated solar AST nodes.

- Add parser/source.rs with owned doc structs
- Rewrite Parser to walk solar AST items directly
- Parse doc comments from solar's DocComments (raw text)
- Update builder to use solar AST from gcx, remove solang re-parse
- Update writer and preprocessor layers for owned structs
- Delete solang_ext/ module (Visitor, Visitable, AstEq, etc.)
- Remove solang-parser dependency from forge-doc
- Decouple chisel from forge-doc (inline CodeLocation/SafeUnwrap)

Co-authored-by: Amp <amp@ampcode.com>
@mablr mablr marked this pull request as ready for review April 24, 2026 15:04
@DaniPopes
Copy link
Copy Markdown
Member

would be nicer to rewrite from scratch and have an actual test harness and suite for this, but i guess at this point we can leave that for the future.

Copy link
Copy Markdown
Collaborator

@stevencartavia stevencartavia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just a minor nit

Comment thread crates/doc/src/writer/as_doc.rs
@mablr mablr requested a review from stevencartavia April 27, 2026 21:42
stevencartavia
stevencartavia previously approved these changes Apr 27, 2026
Comment thread crates/doc/src/parser/mod.rs Outdated
zerosnacks
zerosnacks previously approved these changes Apr 29, 2026
Copy link
Copy Markdown
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment thread crates/doc/Cargo.toml
rayon.workspace = true
serde_json.workspace = true
serde.workspace = true
solang-parser.workspace = true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can then also remove the top level solang-parser @mablr

solang-parser = { version = "=0.3.9", package = "foundry-solang-parser" }

foundry-solang-parser.opt-level = 3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is it still required in Chisel? If so, can we also tackle that in this PR?

@zerosnacks zerosnacks self-requested a review April 29, 2026 12:00
@zerosnacks zerosnacks dismissed their stale review April 29, 2026 12:01

See notes, overall lgtm; would like to fully deprecate solang

Copy link
Copy Markdown
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets fully deprecate Solang in Chisel in a follow up, PR lgtm as is

@mablr mablr merged commit 5fda36a into master Apr 29, 2026
17 checks passed
@github-project-automation github-project-automation Bot moved this to Done in Foundry Apr 29, 2026
@mablr mablr deleted the mablr/migrate-forge-doc-solang-to-solar branch April 29, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants